package org.codeart.template.example1;

/**
 * 抽象父类
 */
public abstract class AbstractClassTemplate {
    
    public void step1(String key) {
        System.out.println("在模板类中: 执行步骤1");
        if (step2(key)) {
            step3();
        } else {
            step4();
        }
        step5();
    }

    public boolean step2(String key) {
        System.out.println("在模板类中: 执行步骤2");
        return "x".equals(key);
    }
    
    protected abstract void step3();
    
    protected abstract void step4();

    public void step5() {
        System.out.println("在模板类中: 执行步骤5");
    }
    
    public void run(String key) {
        step1(key);
    }
}
